<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>搜索后台页面</title>
</head>

<body>
    <div>
        <h1>普通用户管理</h1>
        <hr>
        <form action="search.php" method="get">
            <input type="text" name="username" value="<?php echo $_GET['username']; ?>">
            <input type="submit" value="搜索">
        </form>
        <hr>
        <table border="1px">
            <thead>
                <td>ID</td>
                <td>用户名</td>
                <td>注册时间</td>
                <td>动作</td>
            </thead>
            <?php

            require 'connect.php';
            $user = $_GET['username'];

            $sql = 'select * from user where username like "%' . $user . '%"';
            $result = mysqli_query($link, $sql);
            $id = 1;
            while ($row = mysqli_fetch_array($result)) {
                $user = $row['username'];
                if ($user == 'admin') {
                    continue;
                }
                $uid = $row['id'];
                $reg = $row['reg_time'];
                echo "<tr>";
                echo "<td>$id</td>";
                echo "<td>$user</td>";
                echo "<td>$reg</td>";
                echo "<td><a href='del_user.php?uid=$uid'>删除</a> <a href='change_passwd1.php?username=$user&uid=$uid'>修改密码</a></td>";
                echo "</tr>";
                $id++;
                // print_r($row);

            }

            ?>
        </table>
    </div>
</body>

</html>